#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>
#include<string.h>

int fun(int* a, int* b)
{
	int i = 0;
	for (i = 0; i < 26; i++)
	{
		if (*(a + i) != *(b + i))
			return 0;
	}
	return 1;
}
int main()
{
	char a[101] = { 0 }, b[101] = { 0 };
	gets(a);
	gets(b);
	int len_a = strlen(a), len_b = strlen(b), i = 0, count_a[26] = { 0 }, count_b[26] = { 0 };
	for (i = 0; i < len_a; i++)
	{
		if (a[i] >= 'a' && a[i] <= 'z')
			count_a[a[i] - 'a']++;
		else if (a[i] >= 'A' && a[i] <= 'Z')
			count_a[a[i] - 'A']++;
	}
	for (i = 0; i < len_b; i++)
	{
		if (b[i] >= 'a' && b[i] <= 'z')
			count_b[b[i] - 'a']++;
		else if (b[i] >= 'A' && b[i] <= 'Z')
			count_b[b[i] - 'A']++;
	}
	if (fun(count_a, count_b) == 1)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}